import java.util.Arrays;
import java.util.Scanner;

public class ArrayDemo07 {
    public static void main(String[] args) {
        int[] nums = new int[10];
        Scanner scanner = new Scanner(System.in);
        int oIndex = 0;
        int jIndex = 1;
        for (int i = 0; i < 10; i++) {
            System.out.println(Arrays.toString(nums));
            System.out.println("请输入数字");
            int num = scanner.nextInt();
            if (num % 2 == 0) {
                if (oIndex <= 8) {// 最大偶数就是8
                    nums[oIndex] = num;
                    oIndex += 2;
                } else {// 多输的偶数。这次不能生效
                    i--;
                }

            } else {
                if (jIndex <= 9) {// 最大的奇数索引就是9
                    nums[jIndex] = num;
                    jIndex += 2;// jindex = jindex+2
                } else {// 多输的奇数，这次不能生效
                    i--;
                }

            }
        }



    }
}
